package customer.zspt.cn.customer.Widget.chat;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.lidroid.xutils.BitmapUtils;

import customer.zspt.cn.customer.R;
import customer.zspt.cn.customer.utils.TimestampToBj;
/**
 * Created by Administrator on 2018/7/24 0024.
 */
public class ChatFileLeftMsgItem extends LinearLayout {
    private final TextView msg_time;
    private final ImageView header_portrait;
    private final TextView FileTitle;
    private final TextView File_Size;
    private final TextView LffileUrl;
    private BitmapUtils utils;
    public ChatFileLeftMsgItem(Context context) {
        this(context,null);
    }
    public ChatFileLeftMsgItem(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs,0);
    }
    public ChatFileLeftMsgItem(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        utils = new BitmapUtils(context);
        View.inflate(context, R.layout.chat_msg_file_left_item,this);
        msg_time = (TextView) findViewById(R.id.msg_time);
        header_portrait = (ImageView) findViewById(R.id.header_portrait);
        FileTitle = (TextView) findViewById(R.id.FileTitle);
        File_Size = (TextView) findViewById(R.id.File_Size);
        LffileUrl = (TextView)findViewById(R.id.LffileUrl);
    }

    public void setHeader_portrait(String header_portraitUrl){
        utils.display(header_portrait,header_portraitUrl);
    }
    public void setfileUrl(String lffileUrl){
        LffileUrl.setText(lffileUrl);
    }

    public void setFileTitle(String fileTitle){
        FileTitle.setText(fileTitle);
    }

    public void setFile_Size(String file_size){
        File_Size.setText(file_size);
    }
    public void setTime(long time,long ChatTime)
    {
        if (time - ChatTime > 3 * 60 * 1000) {
            msg_time.setText(TimestampToBj.getBeijingTime(time));
        } else {
            msg_time.setVisibility(View.GONE);
        }
    }
}
